﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DBEngine.Elements
{

    public class ClientInfo :Element
    {
        public enum GenderEnum {Male,Female };
        public enum Fields { ID, FirstName, LastName, Address, Tel, Mobile, Email, DateOfBirth, Gender, MembershipID };
        private string mFirstName;
        private string mLastName;
        private string mAddress;
        private string mTel;
        private string mMobile;
        private string mEmail;
        private DateTime mDateOfBith;
        private GenderEnum mGender;
        private int mMembershipID;


        public ClientInfo() { }

        public ClientInfo(string mFirstName, string mLastName,string mAddress,string mTel, string mMobile, string mEmail,DateTime mDateOfBith, GenderEnum mGender, int mMembershipID) 
        {
            this.mFirstName = mFirstName; 
            this.mLastName= mLastName;
            this.mAddress = mAddress;
            this.mTel = mTel;
            this.mMobile= mMobile;
            this.mEmail = mEmail;
            this.mDateOfBith= mDateOfBith;
            this.mGender = mGender;
            this.mMembershipID= mMembershipID;
        }
        public ClientInfo(int mID,string mFirstName, string mLastName, string mAddress, string mTel, string mMobile, string mEmail, DateTime mDateOfBith, GenderEnum mGender, int mMembershipID)
        {
            this.mID = mID;
            this.mFirstName = mFirstName;
            this.mLastName = mLastName;
            this.mAddress = mAddress;
            this.mTel = mTel;
            this.mMobile = mMobile;
            this.mEmail = mEmail;
            this.mDateOfBith = mDateOfBith;
            this.mGender = mGender;
            this.mMembershipID = mMembershipID;
        }

        public Object this[Fields field]
        {
            get 
            {
                Object retval = null ;
                switch (field)
                {
                    case Fields.ID:
                        retval = mID;
                        break;

                    case Fields.FirstName:
                        retval = mFirstName;
                        break;
                   
                    case Fields.LastName:
                        retval = mLastName;
                        break;

                    case Fields.Address:
                        retval = mAddress;
                        break;

                    case Fields.Tel:
                        retval = mTel;
                        break;

                    case Fields.Mobile:
                        retval = mMobile;
                        break;

                    case Fields.Email:
                        retval = mEmail;
                        break;

                    case Fields.DateOfBirth:
                        retval = mDateOfBith;
                        break;

                    case Fields.Gender:
                        retval = mGender;
                        break;

                    case Fields.MembershipID:
                        retval = mMembershipID;
                        break;
                    //default: retval = null;
                }
                return retval ;
            }
            set 
            {
                switch (field)
                {
                    case Fields.ID:
                        mID =Convert.ToInt16 (value);
                        break;

                    case Fields.FirstName:
                       mFirstName= (string)value;
                        break;

                    case Fields.LastName:
                        mLastName = (string)value;
                        break;

                    case Fields.Address:
                        mAddress = (string)value;
                        break;

                    case Fields.Tel:
                        mTel = (string)value;
                        break;

                    case Fields.Mobile:
                        mMobile = (string)value;
                        break;

                    case Fields.Email:
                        mEmail = (string)value;
                        break;

                    case Fields.DateOfBirth:
                        mDateOfBith = (DateTime)value;
                        break;

                    case Fields.Gender:
                        mGender = (GenderEnum)Enum.Parse(typeof(ClientInfo.GenderEnum), (string)value);
                        break;
                    
                    case Fields.MembershipID:
                        mMembershipID = (int)value;
                        break;
                    //default: retval = null;
                }
               
            }
        }


    }
}
